package com.yulamg.core.service.impl;

import com.yulamg.core.respository.UserRespository;
import com.yulamg.core.service.UserService;
import com.yulamg.core.user.User;
import net.bytebuddy.utility.RandomString;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserRespository respository;

    @Override
    public void create(User user) {
        user.setId(RandomString.make(10));
        respository.save(user);
    }

    @Override
    public void update(User user, String id) {

    }

    @Override
    public User get(String id) {
        return respository.findById(id).get();
    }

    @Override
    public void delete(String id) {

    }

    @Override
    public List<User> list(String name) {
        return null;
    }
}
